package com.imooc.framework.web;

import com.dc.ssmspringbootstarter.service.MyStarterService;
import com.dc.ssmspringbootstarter.service.SmsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.sql.DataSource;

@RestController
public class HelloController {

    //IMyStarterService在自定义的starter中已经完成了自动配置，所以此处可以直接注入
    @Autowired
    private MyStarterService myStarterService ;

    @RequestMapping(value="/hello", method = RequestMethod.GET)
    @ResponseBody
    public String hello(){
        String sentence = "Hello World";
        System.out.println(sentence);
        return myStarterService.myStarterTest("test");
    }
    @RequestMapping(value="/hi", method = RequestMethod.GET)
    @ResponseBody
    public String hi(){
        String sentence = "Hi World";
        System.out.println(sentence);
        return sentence;
    }

    @Autowired
    private SmsService smsService;
    @RequestMapping("/sms/send")
    public String sendSms(){
        smsService.send("16607478549","签名","1000","你好自定义短信发送starter");
        return "success";
    }
}
